﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public abstract class BaseUI: MonoBehaviour 
{
    static Canvas _root;
    static Canvas RootCanvas
    {
        get
        {
            if(_root == null)
            {
                var canvasGo =  GameObject.Find("Canvas");
                if(canvasGo == null)
                {
                    var canvas_prefab=  Resources.Load("UI/Canvas");
                    canvasGo = (GameObject)Instantiate(canvas_prefab);
                    DontDestroyOnLoad(canvasGo);
                    _root = canvasGo.GetComponent<Canvas>();
                }
            }
            return _root;
        }
    }

    public int ui_Id;
    //protected T 
    public abstract UIConst UI_Type { get; }

    public virtual void OnHide()
    {

    }
    public virtual void OnClose()
    {

    }

}
